home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / termsorc.lha / Extras / Source / gtlayout-source.lha / LTP_PrintLabel.c < prev    next >
C/C++ Source or Header  |  1995-09-24  |  991b  |  49 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. VOID __regargs
  10. LTP_PrintLabel(LayoutHandle *handle,ObjectNode *node,UWORD left,UWORD top)
  11. {
  12.     STRPTR    label;
  13.     LONG    len;
  14.  
  15.     LTP_SetAPen(&handle -> RPort,handle -> TextPen);
  16.  
  17.     Move(&handle -> RPort,left - (node -> LabelWidth + INTERWIDTH),top + handle -> RPort . TxBaseline);
  18.  
  19.     label = node -> Label;
  20.  
  21.     len = 0;
  22.  
  23.     while(label[len] && (label[len] != '_'))
  24.         len++;
  25.  
  26.     LockLayerRom(handle -> RPort . Layer);
  27.  
  28.     if(len)
  29.         Text(&handle -> RPort,label,len);
  30.  
  31.     if(label[len] == '_' && label[len + 1])
  32.     {
  33.         ULONG OldStyle;
  34.  
  35.         OldStyle = SetSoftStyle(&handle -> RPort,FSF_UNDERLINED,AskSoftStyle(&handle -> RPort));
  36.  
  37.         Text(&handle -> RPort,label + len + 1,1);
  38.  
  39.         SetSoftStyle(&handle -> RPort,OldStyle & ~FSF_UNDERLINED,OldStyle);
  40.  
  41.         label += len + 2;
  42.  
  43.         if(len = strlen(label))
  44.             Text(&handle -> RPort,label,len);
  45.     }
  46.  
  47.     UnlockLayerRom(handle -> RPort . Layer);
  48. }
  49.